package com.gopay.common.domain.cps;

import com.gopay.common.cipher.utils.SensitiveInfoUtils;
import com.gopay.common.constants.cps.RefundFlag;
import com.gopay.common.domain.BaseEntity;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;

/**
 * @CpsGenReceiptOrder.java
 * @author MA HUAN
 * @2013-8-20 下午12:18:27  www.gopay.com.cn Inc.All rights reserved.
 */
@Entity
@Table(name = "CPS_GEN_RECEIPT_ORDER")
public class CpsGenReceiptOrder extends BaseEntity {
    private static final long serialVersionUID = 4306315275653170858L;
    private String gopayOrderId;
    private int version;
    private String otherRecvInfo;
    private BigDecimal totalRefundFeeAmt;
    private BigDecimal totalRefundAmt;
    private BigDecimal merTiliuAmt;
    private String merTiliuRecvAcct;
    private BigDecimal orderBankFeeAmt;
    private String authStaCd;
    private String authId;
    private RefundFlag isRefund;
    private Date createdTs;
    private Date lastUpdTs;
    private String lastUpdTrancode;
    private String remark1;
    private String remark2;
    private BigDecimal refundUsedLimit;
    private String epBankCardNo;
    
  //商户上送的快捷卡 真实信息
    private String buyerRealMobile; //商户上送真实手机号
    private String buyerRealCertNo; //商户上送真实身份证号
    private String buyerRealBankAcctNum; //商户上送真实银行卡号
    private String buyerRealName;   //商户上送真实姓名

    
  //add by dongdh 20160504
    private BigDecimal authenticationFee; ///鉴权手续费
    private String smsAdvice;   //短信建议
    private String authenticationResult;  //鉴权结果
    private String certificateType;  //证件类型
    private String bankCardType;  //卡类型
    private String creditCardExpired; // 信用卡

    private String dfSettleTime; //存管账户资金结算时间 add  by liuyong

    private String contractNo; //快捷绑卡协议号 add by sh.jiao 20170401
    private String otherRecvFlag;//分账标识
    private String otherRecvType;//分账方式1-固定分账 2-按比例分账 3-混合分账
    private String isDeductFeeAmt; //是否扣除手续费标志，0未扣除，1已扣除
    private String otherRecvSytle;  //分账类型 ，1，实时；2，延时
    private String otherRecvTime;   //分账开始时间
    private String otherRecvStatus;  //分账状态;1,待分账，2，分账成功，3，分账失败
    private String isForceRecv;      //是否强制分账 0，正常，1强制
    private Date subAcctFinishTime; //分账完成时间

    
    @Id
    @Column(name = "GOPAY_ORDER_ID", unique = true, nullable = false, length = 30)
    public String getGopayOrderId() {
        return this.gopayOrderId;
    }

    public void setGopayOrderId(String gopayOrderId) {
        this.gopayOrderId = gopayOrderId;
    }

    @Version
    @Column(name = "VERSION", nullable = false, precision = 22, scale = 0)
    public int getVersion() {
        return this.version;
    }

    public void setVersion(int version) {
        this.version = version;
    }

    @Column(name = "OTHER_RECV_INFO", length = 500)
    public String getOtherRecvInfo() {
        return this.otherRecvInfo;
    }

    public void setOtherRecvInfo(String otherRecvInfo) {
        this.otherRecvInfo = otherRecvInfo;
    }

    @Column(name = "TOTAL_REFUND_FEE_AMT", nullable = false, precision = 20)
    public BigDecimal getTotalRefundFeeAmt() {
        return this.totalRefundFeeAmt;
    }

    public void setTotalRefundFeeAmt(BigDecimal totalRefundFeeAmt) {
        this.totalRefundFeeAmt = totalRefundFeeAmt;
    }

    @Column(name = "TOTAL_REFUND_AMT", nullable = false, precision = 20)
    public BigDecimal getTotalRefundAmt() {
        return this.totalRefundAmt;
    }

    public void setTotalRefundAmt(BigDecimal totalRefundAmt) {
        this.totalRefundAmt = totalRefundAmt;
    }

    @Column(name = "MER_TILIU_AMT", precision = 20)
    public BigDecimal getMerTiliuAmt() {
        return this.merTiliuAmt;
    }

    public void setMerTiliuAmt(BigDecimal merTiliuAmt) {
        this.merTiliuAmt = merTiliuAmt;
    }

    @Column(name = "MER_TILIU_RECV_ACCT", length = 19)
    public String getMerTiliuRecvAcct() {
        return this.merTiliuRecvAcct;
    }

    public void setMerTiliuRecvAcct(String merTiliuRecvAcct) {
        this.merTiliuRecvAcct = merTiliuRecvAcct;
    }

    @Column(name = "ORDER_BANK_FEE_AMT", nullable = false, precision = 20)
    public BigDecimal getOrderBankFeeAmt() {
        return this.orderBankFeeAmt;
    }

    public void setOrderBankFeeAmt(BigDecimal orderBankFeeAmt) {
        this.orderBankFeeAmt = orderBankFeeAmt;
    }

    @Column(name = "AUTH_STA_CD", length = 2)
    public String getAuthStaCd() {
        return this.authStaCd;
    }

    public void setAuthStaCd(String authStaCd) {
        this.authStaCd = authStaCd;
    }

    @Column(name = "AUTH_ID", length = 10)
    public String getAuthId() {
        return this.authId;
    }

    public void setAuthId(String authId) {
        this.authId = authId;
    }

    @Column(name = "IS_REFUND", nullable = false, precision = 22, scale = 0)
    @Enumerated(EnumType.ORDINAL)
    public RefundFlag getIsRefund() {
        return this.isRefund;
    }

    public void setIsRefund(RefundFlag isRefund) {
        this.isRefund = isRefund;
    }

    @Column(name = "CREATED_TS", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    public Date getCreatedTs() {
        return this.createdTs;
    }

    public void setCreatedTs(Date createdTs) {
        this.createdTs = createdTs;
    }

    @Column(name = "LAST_UPD_TS", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    public Date getLastUpdTs() {
        return this.lastUpdTs;
    }

    public void setLastUpdTs(Date lastUpdTs) {
        this.lastUpdTs = lastUpdTs;
    }

    @Column(name = "LAST_UPD_TRANCODE", length = 10)
    public String getLastUpdTrancode() {
        return this.lastUpdTrancode;
    }

    public void setLastUpdTrancode(String lastUpdTrancode) {
        this.lastUpdTrancode = lastUpdTrancode;
    }

    @Column(name = "REMARK1", length = 50)
    public String getRemark1() {
        return this.remark1;
    }

    public void setRemark1(String remark1) {
        this.remark1 = remark1;
    }

    @Column(name = "REMARK2", length = 50)
    public String getRemark2() {
        return this.remark2;
    }

    public void setRemark2(String remark2) {
        this.remark2 = remark2;
    }

    @Column(name = "REFUND_USED_LIMIT")
	public BigDecimal getRefundUsedLimit() {
		return refundUsedLimit;
	}

	public void setRefundUsedLimit(BigDecimal refundUsedLimit) {
		this.refundUsedLimit = refundUsedLimit;
	}
    
    

    @Column(name = "EP_BANK_CARD_NO", length = 150)
	public String getEpBankCardNo() {
    	/**
    	 * modify by zyt，在程序中获取的时候进行解密操作，如果是hibernate自己调用（save等），则返回原值；
    	 * 2017-1-5
    	 */
    	this.epBankCardNo = SensitiveInfoUtils.autoReencrypt(this.epBankCardNo);
        return SensitiveInfoUtils.smartDecryptWithCheck(this.epBankCardNo);
	}

	public void setEpBankCardNo(String epBankCardNo) {
		/**
    	 * modified by zyt，判断传入字符串是否经过加密，如果是，则设置为原文，否则设置为加密后的值
    	 * 2017-1-5
    	 */
    	this.epBankCardNo = SensitiveInfoUtils.smartEncryptWithCheck(epBankCardNo);
	}

	 @Column(name = "BUYER_REAL_MOBILE", length = 150)
		public String getBuyerRealMobile() {
			/**
	    	 * modify by zyt，在程序中获取的时候进行解密操作，如果是hibernate自己调用（save等），则返回原值；
	    	 * 因为这个字段在网关传递进来的时候会保持des加密，所以返回的时候需要解密
	    	 * 2017-1-5
	    	 */
		 	this.buyerRealMobile = SensitiveInfoUtils.autoReencrypt(this.buyerRealMobile);
	        return SensitiveInfoUtils.smartDecryptWithCheck(this.buyerRealMobile);
		}

		public void setBuyerRealMobile(String buyerRealMobile) {
			/**
	    	 * modified by zyt，判断传入字符串是否经过加密，如果是，则设置为原文，否则设置为加密后的值
	    	 * 2017-1-10
	    	 */
	    	this.buyerRealMobile = SensitiveInfoUtils.smartEncryptWithCheck(buyerRealMobile);
		}

		@Column(name = "BUYER_REAL_NAME", length = 150)
		public String getBuyerRealName() {
			/**
	    	 * modify by zyt，在程序中获取的时候进行解密操作，如果是hibernate自己调用（save等），则返回原值；
	    	 * 2017-1-5
	    	 */
			this.buyerRealName = SensitiveInfoUtils.autoReencrypt(this.buyerRealName);
	        return SensitiveInfoUtils.smartDecryptWithCheck(this.buyerRealName);
		}

		public void setBuyerRealName(String buyerRealName) {
			/**
	    	 * modified by zyt，判断传入字符串是否经过加密，如果是，则设置为原文，否则设置为加密后的值
	    	 * 2017-1-5
	    	 */
	    	this.buyerRealName = SensitiveInfoUtils.smartEncryptWithCheck(buyerRealName);
		}

		@Column(name = "BUYER_REAL_BANK_ACCT_NUM", length = 150)
		public String getBuyerRealBankAcctNum() {
			/**
	    	 * modify by zyt，在程序中获取的时候进行解密操作，如果是hibernate自己调用（save等），则返回原值；
	    	 * 2017-1-5
	    	 */
			this.buyerRealBankAcctNum = SensitiveInfoUtils.autoReencrypt(this.buyerRealBankAcctNum);
	        return SensitiveInfoUtils.smartDecryptWithCheck(this.buyerRealBankAcctNum);
		}

		public void setBuyerRealBankAcctNum(String buyerRealBankAcctNum) {
			/**
	    	 * modified by zyt，判断传入字符串是否经过加密，如果是，则设置为原文，否则设置为加密后的值
	    	 * 2017-1-5
	    	 */
	    	this.buyerRealBankAcctNum = SensitiveInfoUtils.smartEncryptWithCheck(buyerRealBankAcctNum);
		}

		@Column(name = "BUYER_REAL_CERT_NO", length = 150)
		public String getBuyerRealCertNo() {
			/**
	    	 * modified by zyt，此字段会存放gateway上送的密文身份证号，保留之前的加密方式，仅在使用的时候做解密操作
	    	 * 2017-1-5
	    	 */
			this.buyerRealCertNo = SensitiveInfoUtils.autoReencrypt(this.buyerRealCertNo);
			return SensitiveInfoUtils.smartDecryptWithCheck(this.buyerRealCertNo);
		}

		public void setBuyerRealCertNo(String buyerRealCertNo) {
			/**
	    	 * modified by zyt，判断传入字符串是否经过加密，如果是，则设置为原文，否则设置为加密后的值
	    	 * 2017-1-10
	    	 */
	    	this.buyerRealCertNo = SensitiveInfoUtils.smartEncryptWithCheck(buyerRealCertNo);
		}
		
		@Column(name = "authentication_Fee")
	    public BigDecimal getAuthenticationFee() {
	        return authenticationFee;
	    }

	    public void setAuthenticationFee(BigDecimal authenticationFee) {
	        this.authenticationFee = authenticationFee;
	    }

	    @Column(name = "sms_Advice")
	    public String getSmsAdvice() {
	        return smsAdvice;
	    }

	    public void setSmsAdvice(String smsAdvice) {
	        this.smsAdvice = smsAdvice;
	    }

	    @Column(name = "authentication_Result")
	    public String getAuthenticationResult() {
	        return authenticationResult;
	    }

	    public void setAuthenticationResult(String authenticationResult) {
	        this.authenticationResult = authenticationResult;
	    }

	    @Column(name = "certificate_Type")
	    public String getCertificateType() {
	        return certificateType;
	    }

	    public void setCertificateType(String certificateType) {
	        this.certificateType = certificateType;
	    }

	    @Column(name = "Bank_Card_Type")
	    public String getBankCardType() {
	        return bankCardType;
	    }

	    public void setBankCardType(String bankCardType) {
	        this.bankCardType = bankCardType;
	    }

	    @Column(name = "credit_Card_Expired")
	    public String getCreditCardExpired() {
	    	/**
	    	 * modify by zyt，在程序中获取的时候进行解密操作，如果是hibernate自己调用（save等），则返回原值；
	    	 * 2017-1-5
	    	 */
	    	this.creditCardExpired = SensitiveInfoUtils.autoReencrypt(this.creditCardExpired);
	        return SensitiveInfoUtils.smartDecryptWithCheck(this.creditCardExpired);
	    }

	    public void setCreditCardExpired(String creditCardExpired) {
	    	/**
	    	 * modified by zyt，判断传入字符串是否经过加密，如果是，则设置为原文，否则设置为加密后的值
	    	 * 2017-1-5
	    	 */
	    	this.creditCardExpired = SensitiveInfoUtils.smartEncryptWithCheck(creditCardExpired);
	    }

    @Column(name = "DF_SETTLE_TIME")
    public String getDfSettleTime() {
        return dfSettleTime;
    }

    public void setDfSettleTime(String dfSettleTime) {
        this.dfSettleTime = dfSettleTime;
    }

    @Column(name = "CONTRACT_NO")
    public String getContractNo() {
        return contractNo;
    }

    public void setContractNo(String contractNo) {
        this.contractNo = contractNo;
    }

    @Column(name = "OTHER_RECV_FLAG", length = 2)
    public String getOtherRecvFlag() {
        return otherRecvFlag;
    }

    public void setOtherRecvFlag(String otherRecvFlag) {
        this.otherRecvFlag = otherRecvFlag;
    }

    @Column(name = "OTHER_RECV_TYPE", length = 2)
    public String getOtherRecvType() {
        return otherRecvType;
    }

    public void setOtherRecvType(String otherRecvType) {
        this.otherRecvType = otherRecvType;
    }

    @Column(name = "IS_DEDUCT_FEE_AMT", length = 1)
    public String getIsDeductFeeAmt() {
        return isDeductFeeAmt;
    }

    public void setIsDeductFeeAmt(String isDeductFeeAmt) {
        this.isDeductFeeAmt = isDeductFeeAmt;
    }

    @Column(name = "OTHER_RECV_SYTLE", length = 2)
    public String getOtherRecvSytle() {
        return otherRecvSytle;
    }

    public void setOtherRecvSytle(String otherRecvSytle) {
        this.otherRecvSytle = otherRecvSytle;
    }

    @Column(name = "OTHER_RECV_TIME", length = 20)
    public String getOtherRecvTime() {
        return otherRecvTime;
    }

    public void setOtherRecvTime(String otherRecvTime) {
        this.otherRecvTime = otherRecvTime;
    }

    @Column(name = "OTHER_RECV_STATUS", length = 2)
    public String getOtherRecvStatus() {
        return otherRecvStatus;
    }

    public void setOtherRecvStatus(String otherRecvStatus) {
        this.otherRecvStatus = otherRecvStatus;
    }

    @Column(name = "IS_FORCE_RECV", length = 2)
    public String getIsForceRecv() {
        return isForceRecv;
    }

    public void setIsForceRecv(String isForceRecv) {
        this.isForceRecv = isForceRecv;
    }

    @Column(name = "SUB_ACCT_FINISH_TIME")
    public Date getSubAcctFinishTime() {
        return subAcctFinishTime;
    }

    public void setSubAcctFinishTime(Date subAcctFinishTime) {
        this.subAcctFinishTime = subAcctFinishTime;
    }
}
